<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.jeecgframework.web.system.pojo.base.CbsServiceLogEntity" %>
<%@include file="/context/mytags.jsp"%>
<html>
<head>
    <title>光管翻新验收单</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
    <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
</head>
<script>
    $(function () {
        $('#esTypeId').combotree({
            url: 'cbsTechologyAgreeReportController.do?getEqTypes',
        });
        changePhotoType();
    })

    function getCity() {
        var province = $("#province").val();
        //alert("province:"+province)
        $.ajax({
            type:"post",
            dataType:"json",
            data:{"province":province},
            url:"cbsLightReportController.do?getCityByCode",
            success:function (data) {
                var obj = data.obj;
                console.log("obj:"+obj)
                var html = " <option value=''>--请选择城市--</option>";
                for (i in obj){
                    html+="<option value='"+obj[i].territoryCode+"'>"+obj[i].territoryName+"</option>";
                }
                $('#city').html(html)

            }
        })
    }

    $(function(){
        var serviceId = $("#serviceId").val();
        $("#uploadFinishFile").uploadify({
            buttonText : '选择文件',
            auto : true,
            progressData : 'speed',
            multi : true,
            height : 20,
            width : 60,
            overrideEvents : ['onDialogClose'],
            queueID : 'instructionfile',
            /*fileTypeDesc : '文件格式:',
            fileTypeExts : '*.*',*/
            fileTypeDesc : '文件格式:',
            fileTypeExts : '*', //控制可上传文件的扩展名，启用本项时需同时声明fileDesc
            fileSizeLimit : '50MB',
            swf : 'plug-in/uploadify/uploadify.swf',
            uploader :  '<%=basePath%>/cbsLightReportController.do?fileUploadView&serviceId='+serviceId+'&sessionId='+$("#sessionId").val()+'',
            onUploadStart:function(){
                lockmask(true,'请稍等,导入中...');
            },
            onUploadSuccess : function(file,data) {
                lockmask(false);
                var json = $.parseJSON(data).attributes;
                var name = json.name;
                var ins = name.lastIndexOf(".");
                var ins2 = name.length;
                var ho = name.substring(ins, ins2);
                var photoType = "完工单附件";
                var photoName = photoType + ho;
                var fileIds = $("#fileId").val();
                $("#finishFile").val(json.id);
                var html = '<span id="li_file_'+json.id+'"><span class="color-blue" id="'+json.id+'"  name="fileNames">'+photoName+'</span>&nbsp;&nbsp; ' +
                        '<input id="finishFile'+json.id+'" name="finishFileName" hidden="hidden" value="'+json.id+'">'+
                    '<span style="cursor: pointer;" onclick=\'delFinishFile("'+json.id+'")\'>删除</span>&emsp;</span>'
                $("#file1").prepend(html);
                $.ajax({
                    type: "post",
                    data: {"id": json.id, "name": photoName},
                    dataType: "json",
                    url: "cbsServiceReportController.do?changeName",
                    success: function (data) {
                        var b = data.success;
                    }
                })
                // tip("上传成功！");
            },onFallback : function(){
                tip("您未安装FLASH控件，无法上传文件！请安装FLASH控件后再试");
            },onSelectError : function(file, errorCode, errorMsg){
                switch(errorCode) {
                    case -100:
                        tip("上传的文件数量已经超出系统限制的"+$('#instruction').uploadify('settings','queueSizeLimit')+"个文件！");
                        break;
                    case -110:
                        tip("文件 [" + file.name + "] 大小超出系统限制的50MB大小！");break;
                    case -120:
                        tip("文件 ["+file.name+"] 大小异常！");
                        break;
                    case -130:
                        tip("文件 ["+file.name+"] 类型不正确！");
                        break;
                };
            }
        });
    });
    function delFinishFile(id) {
        var flag = true;
        $.ajax({
            url: "cbsLightReportController.do?delFile",
            data: {
                "id": id
            },
            cache: false,
            dataType: 'json',
            type: 'POST',
            async: false,
            success: function (data) {
                if (!data.success) {
                    flag = false;
                    tip(data.msg);
                } else {
                    tip(data.msg);
                    //隐藏标签
                    $("#li_file_" + id + "").remove();
                    $("#finishFile" + id + "").remove();
                    $("#finishFile").val("");
                }
            }
        });
    }

    function lookBackImg(obj) {
        addOneTab('预览','cbsServiceController.do?openViewFile&fileid='+obj.id)
    }

    function changePhotoType(){
        // alert("val:"+obj.value)
         //alert("text:"+$('#photoType').find("option:selected").text())
        var text=$('#photoType').find("option:selected").text();
        $('#photoTypeName').val(text)
        getPhotoName();
    }

function getPhotoName(){
        var serviceId = $("#serviceId").val();
        var text=$('#photoTypeName').val();

        $("#uploadPhotoFile").uploadify({
            buttonText : '选择照片',
            auto : true,
            progressData : 'speed',
            multi : true,
            height : 20,
            width : 60,
            overrideEvents : ['onDialogClose'],
            queueID : 'instructionfile',
            /*fileTypeDesc : '文件格式:',
            fileTypeExts : '*.*',*/
            fileTypeDesc : '文件格式:',
            fileTypeExts : '*', //控制可上传文件的扩展名，启用本项时需同时声明fileDesc
            fileSizeLimit : '50MB',
            swf : 'plug-in/uploadify/uploadify.swf',
            uploader :  '<%=basePath%>/cbsLightReportController.do?photoFileUploadView&serviceId='+serviceId+'&sessionId='+$("#sessionId").val()+'&photoName='+text+'',
            onUploadStart:function(){
                lockmask(true,'请稍等,导入中...');
            },onUploadSuccess : function(file,data) {
                lockmask(false);
                var json = $.parseJSON(data).attributes;
                var fileIds = $("#fileId").val();
                $("#photo").val(json.id);
                var html = '<div style="width: 200px;display: inline-block"><span id="li_file_'+json.id+'"><span class="color-blue" id="'+json.id+'"  name="fileNames">'+json.name+'</span>&nbsp;' +
                    '<input id="photoFile'+json.id+'" name="photoFileName" hidden="hidden" value="'+json.id+'">'+
                    '<span style="cursor: pointer;" onclick=\'delPhotoFile("'+json.id+'")\'>删除</span>&emsp; </span></div>'
                $("#file2").prepend(html);
                // tip("上传成功！");
            },onFallback : function(){
                tip("您未安装FLASH控件，无法上传文件！请安装FLASH控件后再试");
            },onSelectError : function(file, errorCode, errorMsg){
                switch(errorCode) {
                    case -100:
                        tip("上传的文件数量已经超出系统限制的"+$('#instruction').uploadify('settings','queueSizeLimit')+"个文件！");
                        break;
                    case -110:
                        tip("文件 [" + file.name + "] 大小超出系统限制的50MB大小！");break;
                    case -120:
                        tip("文件 ["+file.name+"] 大小异常！");
                        break;
                    case -130:
                        tip("文件 ["+file.name+"] 类型不正确！");
                        break;
                };
            }
        });
    };
    function delPhotoFile(id) {
        var flag = true;
        $.ajax({
            url: "cbsLightReportController.do?delFile",
            data: {
                "id": id
            },
            cache: false,
            dataType: 'json',
            type: 'POST',
            async: false,
            success: function (data) {
                if (!data.success) {
                    flag = false;
                    tip(data.msg);
                } else {
                    tip(data.msg);
                    //隐藏标签
                    $("#li_file_" + id + "").remove();
                    $("#photoFile" + id + "").remove();
                    $("#photo").val("");
                }
            }
        });
    }



    function ZC(){
        var actualTime=$('#actualTime').val()
        var closeTime=$('#closeTime').val()
        var zyCinemaName=$('#zyCinemaName').val()
        var province=$('#province').val()
        var city=$('#city').val()
        var address=$('#address').val()
        var typename=$('#typename').val()
        var contactsName=$('#contactsName').val()
        var phone=$('#phone').val()
        var sn=$('#sn').val()
        var front_sn=$('#front_sn').val()
        var after_sn=$('#after_sn').val()
        var front_ldfl=$('#front_ldfl').val()
        var after_ldfl=$('#after_ldfl').val()
        var cbserviceCode=$('#cbserviceCode').val()
        var tabName="编辑服务单"+cbserviceCode;

        if(actualTime==null || actualTime==''){
            $('#actualTimeErr').show()
            parent.window.tip("请填写实际上门时间")
            return false;
        }
        if(closeTime==null || closeTime==''){
            $('#closeTimeErr').show()
            parent.window.tip("请填写服务完工时间")
            return false;
        }
        if(zyCinemaName==null || zyCinemaName==''){
            $('#zyCinemaNameErr').show()
            parent.window.tip("请填写影院名称")
            return false;
        }
        if(province==null || province==''){
            $('#cityErr').show()
            parent.window.tip("请填写影院所在省市")
            return false;
        }
        if(city==null || city==''){
            $('#cityErr').show()
            parent.window.tip("请填写影院所在省市")
            return false;
        }
        if(address==null || address==''){
            $('#addressErr').show()
            parent.window.tip("请填写影院地址")
            return false;
        }
        if(typename==null || typename==''){
            $('#typenameErr').show()
            parent.window.tip("请填写院线")
            return false;
        }
        if(contactsName==null || contactsName==''){
            $('#contactsNameErr').show()
            parent.window.tip("请填写联系人姓名")
            return false;
        }
        if(phone==null || phone==''){
            $('#phoneErr').show()
            parent.window.tip("请填写联系人电话")
            return false;
        }
        if(sn==null || sn==''){
            $('#snErr').show()
            parent.window.tip("请填写放映机序列号")
            return false;
        }

        if(front_sn==null || front_sn==''){
            $('#front_snErr').show()
            parent.window.tip("请填翻新前光管序列号")
            return false;
        }
        if(after_sn==null || after_sn==''){
            $('#after_snErr').show()
            parent.window.tip("请填翻新后光管序列号")
            return false;
        }
        if(front_ldfl==null || front_ldfl==''){
            $('#front_ldflErr').show()
            parent.window.tip("请填写翻新前中心亮度")
            return false;
        }else{
            var reg = /^\d+(?:\.\d{2})?$/
            if(!reg.test(front_ldfl)){
                $('#front_ldflErr').show();
                parent.window.tip("请填写正确格式的翻新前中心亮度值")
                return false;
            }else{
                if(front_ldfl>150 || front_ldfl<0){
                    $('#front_ldflErr').show();
                    parent.window.tip("请填写正确格式的翻新前中心亮度值")
                    return false;
                }
            }
        }
        if(after_ldfl==null || after_ldfl==''){
            $('#after_ldflErr').show()
            parent.window.tip("请填写翻新后中心亮度")
            return false;
        }else{
            var reg = /^\d+(?:\.\d{2})?$/
            if(!reg.test(after_ldfl)){
                $('#after_ldflErr').show();
                parent.window.tip("请填写正确格式的翻新前中心亮度值")
                return false;
            }else{
                if(after_ldfl>150 || after_ldfl<0){
                    $('#after_ldflErr').show();
                    parent.window.tip("请填写正确格式的翻新后中心亮度值")
                    return false;
                }
            }
        }

        //var nodes = $('#esTypeId').combotree('tree').tree('getSelected');
        var nodes = $('#esTypeId').combotree('getValue');
        var finishFileIds=[];
        $("input[name='finishFileName']").each(function(j,data){
            console.log(data.value);
            finishFileIds.push(data.value);
        });

        var photoFileIds=[];
        $("input[name='photoFileName']").each(function(j,data){
            console.log(data.value);
            photoFileIds.push(data.value);
        });
        $.ajax({
            type:"post",
            data:{'eqType':nodes},
            url:"cbsTechologyAgreeReportController.do?getTypes",
            dataType:"json",
            success:function (data) {
                var tbs=data.obj;
                // alert(tbs.length);
                if(tbs!=null && tbs.length>0){
                    tip("请选择正确的放映机类型");
                }else{
                    $.ajax({
                        type:"post",
                        data:$("#dataForm").serialize(),
                        url:"cbsLightReportController.do?ZCLightReport",
                        dataType:"json",
                        success:function (data) {
                            if(data.success){
                                tip("暂存成功");
                                closetab(tabName);
                                window.top.$("#maintabs").tabs({
                                    title: tabName,
                                    onBeforeClose: function (title, index) {
                                    }
                                });
                                window.top.$("#maintabs").tabs('close', tabName);
                                addOneTab("服务单管理", "cbsServiceController.do?cbsService");
                                setTimeout("closetab('光管翻新验收单')",1000);
                            }else{
                                tip(data.msg);
                            }
                        }
                    });
                }
            }
        })
    }


    function sub(){

        var actualTime=$('#actualTime').val()
        var closeTime=$('#closeTime').val()
        var zyCinemaName=$('#zyCinemaName').val()
        var province=$('#province').val()
        var city=$('#city').val()
        var address=$('#address').val()
        var typename=$('#typename').val()
        var contactsName=$('#contactsName').val()
        var phone=$('#phone').val()
        var sn=$('#sn').val()
        var front_sn=$('#front_sn').val()
        var after_sn=$('#after_sn').val()
        var front_ldfl=$('#front_ldfl').val()
        var after_ldfl=$('#after_ldfl').val()
        var cbserviceCode=$('#cbserviceCode').val()
        var tabName="编辑服务单"+cbserviceCode;

        if(actualTime==null || actualTime==''){
            $('#actualTimeErr').show()
            parent.window.tip("请填写实际上门时间")
            return false;
        }
        if(closeTime==null || closeTime==''){
            $('#closeTimeErr').show()
            parent.window.tip("请填写服务完工时间")
            return false;
        }
        if(zyCinemaName==null || zyCinemaName==''){
            $('#zyCinemaNameErr').show()
            parent.window.tip("请填写影院名称")
            return false;
        }
        if(province==null || province==''){
            $('#cityErr').show()
            parent.window.tip("请填写影院所在省市")
            return false;
        }
        if(city==null || city==''){
            $('#cityErr').show()
            parent.window.tip("请填写影院所在省市")
            return false;
        }
        if(address==null || address==''){
            $('#addressErr').show()
            parent.window.tip("请填写影院地址")
            return false;
        }
        if(typename==null || typename==''){
            $('#typenameErr').show()
            parent.window.tip("请填写院线")
            return false;
        }
        if(contactsName==null || contactsName==''){
            $('#contactsNameErr').show()
            parent.window.tip("请填写联系人姓名")
            return false;
        }
        if(phone==null || phone==''){
            $('#phoneErr').show()
            parent.window.tip("请填写联系人电话")
            return false;
        }
        if(sn==null || sn==''){
            $('#snErr').show()
            parent.window.tip("请填写放映机序列号")
            return false;
        }

        if(front_sn==null || front_sn==''){
            $('#front_snErr').show()
            parent.window.tip("请填翻新前光管序列号")
            return false;
        }
        if(after_sn==null || after_sn==''){
            $('#after_snErr').show()
            parent.window.tip("请填翻新后光管序列号")
            return false;
        }
        if(front_ldfl==null || front_ldfl==''){
            $('#front_ldflErr').show()
            parent.window.tip("请填写翻新前中心亮度")
            return false;
        }else{
            var reg = /^\d+(?:\.\d{2})?$/
            if(!reg.test(front_ldfl)){
                $('#front_ldflErr').show();
                parent.window.tip("请填写正确格式的翻新前中心亮度值")
                return false;
            }else{
                if(front_ldfl>150 || front_ldfl<0){
                    $('#front_ldflErr').show();
                    parent.window.tip("请填写正确格式的翻新前中心亮度值")
                    return false;
                }
            }
        }
        if(after_ldfl==null || after_ldfl==''){
            $('#after_ldflErr').show()
            parent.window.tip("请填写翻新后中心亮度")
            return false;
        }else{
            var reg = /^\d+(?:\.\d{2})?$/
            if(!reg.test(after_ldfl)){
                $('#after_ldflErr').show();
                parent.window.tip("请填写正确格式的翻新前中心亮度值")
                return false;
            }else{
                if(after_ldfl>150 || after_ldfl<0){
                    $('#after_ldflErr').show();
                    parent.window.tip("请填写正确格式的翻新后中心亮度值")
                    return false;
                }
            }
        }

        // var nodes = $('#esTypeId').combotree('tree').tree('getSelected');
        var nodes = $('#esTypeId').combotree('getValue');
        //alert("nodes:"+nodes.id)
        var finishFileIds=[];
        $("input[name='finishFileName']").each(function(j,data){
            console.log(data.value);
            finishFileIds.push(data.value);
        });

        var photoFileIds=[];
        $("input[name='photoFileName']").each(function(j,data){
            console.log(data.value);
            photoFileIds.push(data.value);
        });
        $.ajax({
            type:"post",
            data:{'eqType':nodes},
            url:"cbsTechologyAgreeReportController.do?getTypes",
            dataType:"json",
            success:function (data) {
                var tbs=data.obj;
                // alert(tbs.length);
                if(tbs!=null && tbs.length>0){
                    tip("请选择正确的放映机类型");
                }else{

                    $.ajax({
                        type:"post",
                        data:$("#dataForm").serialize(),
                        url:"cbsLightReportController.do?subLightReport",
                        async: false,
                        dataType: "json",
                        success: function (data) {
                            if (data.success) {
                                tip("提交成功");
                                var cbserviceId = $('#serviceId').val()
                                $.ajax({
                                    type: "post",
                                    data: {"id": cbserviceId},
                                    url: "cbsServiceReportController.do?getRole",
                                    dataType: "json",
                                    async: false,
                                    success: function (data) {
                                        var rData = data.attributes;
                                        if (rData != null) {
                                            var role = rData.role;
                                            jQuery.messager.confirm('提示:', '是否提交返件申请?', function (event) {
                                                if (event) {
                                                    if (role == "EG" || role == "AEG" || role == "barcoCSE") {
                                                        addOneTab("待返件任务", "cbsReturnEquipmentController.do?cbsReturnEquipmentGCS");
                                                        setTimeout("closetab('光管翻新验收单')", 1000);
                                                    }
                                                    if (role == "HD") {
                                                        addOneTab("返件管理", "cbsReturnEquipmentController.do?cbsReturnEquipmentCSA");
                                                        setTimeout("closetab('光管翻新验收单')", 1000);
                                                    }
                                                    //TODO  打开该服务单的返件申请列表页

                                                } else {
                                                    var type = $("#typeRole").val();
                                                    if (type == '') {
                                                        addOneTab("我的任务", "cbsServiceAssignListController.do?engineerlists");
                                                        setTimeout("closetab('光管翻新验收单')", 1000);

                                                    } else {
                                                        addOneTab("服务单管理", "cbsServiceController.do?cbsService");
                                                        setTimeout("closetab('光管翻新验收单')", 1000);
                                                    }
                                                    // addOneTab("我的任务","cbsServiceAssignListController.do?engineerlists");
                                                    // setTimeout("closetab('光管翻新验收单')",1000);
                                                }
                                            });
                                        } else {
                                            var type = $("#typeRole").val();
                                            if (type == '') {

                                                addOneTab("我的任务", "cbsServiceAssignListController.do?engineerlists");
                                                setTimeout("closetab('光管翻新验收单')", 1000);

                                            } else {
                                                closetab(tabName);
                                                window.top.$("#maintabs").tabs({
                                                    title: tabName,
                                                    onBeforeClose: function (title, index) {
                                                    }
                                                });
                                                window.top.$("#maintabs").tabs('close', tabName);
                                                addOneTab("服务单管理", "cbsServiceController.do?cbsService");
                                                setTimeout("closetab('光管翻新验收单')", 1000);
                                            }
                                        }
                                    }
                                });
                            } else {
                                tip(data.msg);
                            }
                            //setTimeout(" window.location.href='cbsDelinerController.do?cbsDeliner'",1000);
                            //setTimeout("closetab('光管翻新验收单');",1000);
                            // setTimeout(" window.location.href='cbsServiceAssignListController.do?engineerlists'",1000);
                        }
                    })
                }
            }
        })
    }


    function checkeNull(obj) {
        //alert("id:"+obj.id)
        //alert("value:"+obj.value)
        var value=obj.value;
        if(value==null || value==''){
            $('#'+obj.id+'Err').show();
        }else {
            $('#'+obj.id+'Err').hide();
        }
    }

    //判断输入的是否是数字
    function checkeNum(obj) {
        var reg = /^\d+(?:\.\d{2})?$/
        if(!reg.test(obj.value)){
            $('#'+obj.id+'Err').show();
        }else{
            if(obj.value>150 || obj.value<0){
                $('#'+obj.id+'Err').show();
            }else{
                $('#'+obj.id+'Err').hide();
            }
        }
    }
</script>
<body>
<div style="margin-bottom:10px;">
    <div style="text-align: center; width: 100%; ">
        <c:if test="${!editReport}">
            <a class="easyui-linkbutton l-btn" onclick="ZC()">暂存</a>
        </c:if>
        <a href="#" class="easyui-linkbutton l-btn" onclick="sub()">提交</a>
        <input type="hidden" id="sessionId" value="${pageContext.session.id}">
        <input type="hidden" id="typeRole" value="${typeRole}"/>
    </div>
</div>
<form id="dataForm" name="dataForm" action="" method="post">
    <input type="hidden" name="type" value="${type}" id="type">
    <input type="hidden" name="editReport" value="${editReport}" >
<div class="subtitle">
    <p>完工报告</p>
    <table class="nobordertable noborder" id="serviceData">
        <c:if test="${lightReport!=null}">
            <input id="serviceId" hidden="hidden" name="serviceId" value="${lightReport.serviceId.id}">
            <input id="cbserviceCode" hidden="hidden"  value="${lightReport.serviceId.code}">
        </c:if>
        <c:if test="${lightReport==null}">
            <input id="serviceId" hidden="hidden" name="serviceId" value="${cbsServiceEntity.id}">
            <input  id="cbserviceCode" hidden="hidden" value="${cbsServiceEntity.code}"/>
        </c:if>

        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>预计上门时间:</label>
            </td>
            <td width="30%">
                    <c:if test="${lightReport!=null}">
                        <input name="orderTime" readonly="readonly" id="orderTime" value="<fmt:formatDate value='${lightReport.orderTime}' type="date" pattern="yyyy-MM-dd"/>" style="border: white">
                    </c:if>
                    <c:if test="${lightReport==null}">
                        <c:if test="${cbsServiceEntity.orderTimeAgin!=null && cbsServiceEntity.orderTimeAgin!=''}">
                            <input  readonly="readonly" name="orderTime" id="orderTime" value="<fmt:formatDate value='${cbsServiceEntity.orderTimeAgin}' type="date" pattern="yyyy-MM-dd"/>" style="border: white">
                        </c:if>
                        <c:if test="${cbsServiceEntity.orderTimeAgin==null || cbsServiceEntity.orderTimeAgin==''}">
                            <input readonly="readonly" name="orderTime" id="orderTime" value="<fmt:formatDate value='${cbsServiceEntity.orderTime}' type="date" pattern="yyyy-MM-dd"/>" style="border: white">
                        </c:if>
                    </c:if>
            </td>
            <td class="al_r" width="20%">
                <label>实际上门时间:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input onblur="checkeNull(this)" id ="actualTime" name ="actualTime" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           value="<fmt:formatDate value='${lightReport.actualTime}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input onblur="checkeNull(this)" id ="actualTime" name ="actualTime" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           value="<fmt:formatDate value='${arrivalofabnormal.create_date}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                </c:if>
                <span id="actualTimeErr" hidden="hidden" style="color: red;font-size: 10px">实际上门时间不能为空</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>上门次数:</label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input name="sceneTotal" readonly="readonly" type="text" value="${lightReport.sceneTotal}">
                </c:if>
                <c:if test="${lightReport==null}">
                    <input name="sceneTotal" readonly="readonly" type="text" value="${arrivalofabnormal.num}">
                </c:if>
            </td>
            <td class="al_r" width="20%">
                <label>服务完工时间:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input onblur="checkeNull(this)" id ="closeTime" readonly="readonly" name ="closeTime" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           value="<fmt:formatDate value='${lightReport.finishTime}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input onblur="checkeNull(this)" id ="closeTime" name ="closeTime" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           value="<fmt:formatDate value='${cbsServiceEntity.closeTime}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                </c:if>
                <span id="closeTimeErr" style="color: red;font-size: 10px" hidden="hidden">服务完工时间不能为空</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>影院名称:<font color="red">*</font></label>
            </td>
            <td width="30%" valign="top">
                <c:if test="${lightReport!=null}">
                    <input id="zyCinemaName" onkeyup="checkeNull(this)" style="width: 300px" name="zyCinemaName" value="${lightReport.cinemaName}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input id="zyCinemaName" onkeyup="checkeNull(this)" style="width: 300px" name="zyCinemaName" value="${cbsServiceEntity.zyCinemaName}"/>
                </c:if>
                <br><span id="zyCinemaNameErr" style="font-size: 10px;color: red" hidden="hidden">影院名称不能为空</span>
            </td>
            <td class="al_r" width="20%" valign="top">
                <label>影院地址:<font color="red">*</font></label>
            </td>
            <td width="30%" valign="top">
                <select name="province" style="width:100px" id="province" onchange="getCity()">
                    <option value="">--其选择省份--</option>
                    <c:if test="${lightReport!=null}">
                        <c:forEach items="${territoryList}" var="terry">
                            <option <c:if test="${lightReport.sheng.territoryName == terry.territoryName}">selected="selected"</c:if> value="${terry.territoryCode}">${terry.territoryName}</option>
                        </c:forEach>
                    </c:if>
                    <c:if test="${lightReport==null}">
                        <c:forEach items="${territoryList}" var="terry">
                            <option <c:if test="${cbsServiceEntity.province.territoryName == terry.territoryName}">selected="selected"</c:if> value="${terry.territoryCode}">${terry.territoryName}</option>
                        </c:forEach>
                    </c:if>
                </select>
                <select style="width:100px" id="city" name="city" onchange="checkeNull(this)">
                    <option value="">--其选择城市--</option>
                    <c:if test="${lightReport!=null}">
                        <c:forEach items="${cityList}" var="terry">
                            <option <c:if test="${lightReport.shi.territoryName == terry.territoryName}">selected="selected"</c:if> value="${terry.territoryCode}">${terry.territoryName}</option>
                        </c:forEach>
                    </c:if>
                    <c:if test="${lightReport==null}">
                        <c:forEach items="${cityList}" var="city">
                            <option <c:if test="${cbsServiceEntity.city.territoryCode == city.territoryCode}">selected="selected"</c:if> value="${city.territoryCode}">${city.territoryName}</option>
                        </c:forEach>
                    </c:if>
                    <span id="cityErr" style="color: red;font-size: 10px" hidden="hidden">影院所在省市不能为空</span>
                </select>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>所属院线:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input id="typename" onkeyup="checkeNull(this)" name="typename"value="${lightReport.typeIntherterName}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input id="typename" onkeyup="checkeNull(this)" name="typename" value="${cbsServiceEntity.typename}"/>
                </c:if>
                <span id="typenameErr" hidden="hidden" style="font-size: 10px;color:red;">院线不能为空</span>
            </td>
            <td class="al_r" width="20%">

            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input id="address" name="address" style="width: 300px" value="${lightReport.address}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input id="address" name="address" style="width: 300px" value="${cbsServiceEntity.address}"/>
                </c:if>
                <br><span hidden="hidden" id="addressErr" style="color: red;font-size: 10px">影院地址不能为空</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>联系人:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input onkeyup="checkeNull(this)" id="contactsName" name="contactsName" value="${lightReport.contactsName}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input onkeyup="checkeNull(this)" id="contactsName" name="contactsName" value="${cbsServiceEntity.contactsName}"/>
                </c:if>
                <span hidden="hidden" id="contactsNameErr" style="color: red;font-size: 10px">联系人姓名不能为空</span>
            </td>
            <td class="al_r" width="20%">
                <label>电话:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input onkeyup="checkeNull(this)" id="phone" name="phone" value="${lightReport.phone}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input onkeyup="checkeNull(this)" id="phone" name="phone" value="${cbsServiceEntity.contactsPhone}"/>
                </c:if>
                <span hidden="hidden" id="phoneErr" style="color: red;font-size: 10px">联系人电话不能为空</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>放映机序列号:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input onkeyup="checkeNull(this)" id="sn" name="sn" value="${lightReport.sn}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input onkeyup="checkeNull(this)" id="sn" name="sn" value="${cbsServiceEntity.sn}"/>
                </c:if>
                <span hidden="hidden" id="snErr" style="color: red;font-size: 10px">放映机序列号不能为空</span>
            </td>
            <td class="al_r" width="20%">
                <label>放映机型号:</label>
            </td>
            <td width="30%">
                <c:if test="${lightReport!=null}">
                    <input id="esTypeId" name="esTypeId" value="${lightReport.equipmentType.id}"/>
                </c:if>
                <c:if test="${lightReport==null}">
                    <input id="esTypeId" name="esTypeId" value="${cbsServiceEntity.zyEquipmentSpareId.type.id}">
                </c:if>
            </td>
        </tr>
        </tbody>
    </table>

    <div class="line"></div>
    <div style="text-align: center; font-weight: bold;font-size:17px;">现场信息记录</div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>完工单附件:</label>
            </td>
            <td colspan="3">
                <input type="button" value="上传附件" id="uploadFinishFile" />
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%"></td>
            <td colspan="3">
                <span id="file1">
                    <c:forEach items="${finishFileList}" var="file">
                        <input id="finishFile"${file.id} name="fileName" hidden="hidden" value="${file.id}'">
                        <span id="li_file_${file.id}">
                                <%--<span class="color-blue" id="${file.id}" onclick="lookBackImg(this)" name="fileNames">${file.oldFileName}</span>--%>
                             <a href="fileUploadController.do?downLoadFile&fileLogId=${file.id}">${file.oldFileName}</a>
                                <span style="cursor: pointer;" onclick="delFinishFile('${file.id}')">删除</span>&emsp;
                            </span>&emsp;
                    </c:forEach>
                </span>
            </td>
        </tr>

        <tr>
            <td class="al_r" width="20%">
                <label>现场照片:</label>
            </td>
            <td colspan="3">
                <select id="photoType" name="photoType" style="width: auto;" onchange="changePhotoType()">
                    <c:forEach items="${photoTypes}" var="pt">
                        <option value="${pt.typecode}">${pt.typename}</option>
                    </c:forEach>
                </select>
                <input name="photoTypeName" hidden="hidden" id="photoTypeName">
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%"></td>
            <td colspan="3">
                <input type="button" value="上传图片" id="uploadPhotoFile" onclick="getPhotoName()"/>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%"></td>
            <td colspan="3">
                <div id="file2" style="width: 800px">
                    <c:forEach items="${photoFileList}" var="file">

                        <input id="finishFile"${file.id} name="fileName" hidden="hidden" value="${file.id}'"/>
                        <span id="li_file_${file.id}">
                                <%--<span class="color-blue" id="${file.id}" onclick="lookBackImg(this)" name="fileNames">${file.newFileName}</span>--%>
                            <a href="fileUploadController.do?downLoadFile&fileLogId=${file.id}">${file.newFileName}</a>
                                <span style="cursor: pointer;" onclick="delFinishFile('${file.id}')">删除</span>&emsp;
                            </span>&emsp;

                    </c:forEach>
                </div>

            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">

            </td>
            <td colspan="3">
                <span class="color-org">提示：</span>
                <span class="color-hui">以上测试图照片需在无遮掩状态下拍照完整画面，并且聚焦清晰。如有异常需增加细节照片，并在整体照片中圈画出异常位置。</span>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div><span style="font-weight: bold;">翻新光管外观检查</span></div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>光管外观是否损坏:</label>
            </td>
            <td width="30%">
                <select name="isBad" id="isBad">
                    <c:if test="${lightReport.isError==1}">
                        <option value="1" selected="selected">是</option>
                        <option value="0">否</option>
                    </c:if>
                    <c:if test="${lightReport.isError!=1}">
                        <option value="1">是</option>
                        <option value="0" selected="selected">否</option>
                    </c:if>
                </select>
            </td>
            <td class="al_r" width="20%">
                <label>光管各组件是否齐全:</label>
            </td>
            <td width="30%">
                <select name="isComplete" id="isComplete">
                    <c:if test="${lightReport.isComplete==1}">
                        <option value="1" selected="selected">是</option>
                        <option value="0">否</option>
                    </c:if>
                    <c:if test="${lightReport.isComplete!=1}">
                        <option value="1">是</option>
                        <option value="0" selected="selected">否</option>
                    </c:if>
                </select>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>异常说明:</label>
            </td>
            <td colspan="3">
                <span class="color-red">以上情况如有异常或存在其他问题，请做详细描述，并拍照片反馈巴可，同时立即告知影院。</span>
                <textarea id="errorDes" maxlength="200" name="errorDes" style="width: 100%; height: 60px;">${lightReport.ycDes}</textarea>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div><span style="font-weight: bold;">测试数据</span></div>
    <table class="ftable" style="margin-top:10px;">
        <tr>
            <th></th>
            <th>光管序列号</th>
            <th>中心亮度FL</th>
            <th>对比度</th>
            <th>均匀性</th>
        </tr>
        <tr>
            <td>翻新前</td>
            <td >
                <font color="red">*</font><input id="front_sn" name="front_sn" value="${lightReport.frontSn}" onkeyup="checkeNull(this)"/>
                <br><span id="front_snErr" hidden="hidden" style="color: red;font-size: 10px">光管序列号不能为空</span>
            </td>
            <td >
                <font color="red">*</font><input id="front_ldfl" name="front_ldfl" value="${lightReport.frontLdfl}" onkeyup="checkeNum(this)"/>FL
                <br><span id="front_ldflErr" hidden="hidden"  style="color: red;font-size: 10px">请输如0-150之间的整数或小数点后两位数字</span>
            </td>
            <td><input id="front_dbd" name="front_dbd" value="${lightReport.frontDbd}"/></td>
            <td ><input id="front_jyx" name="front_jyx" value="${lightReport.frontJyx}"/></td>
        </tr>
        <tr>
            <td>翻新后</td>
            <td >
                <font color="red">*</font><input id="after_sn" name="after_sn" value="${lightReport.afterSn}" onkeyup="checkeNull(this)"/>
                <br><span id="after_snErr" hidden="hidden"  style="color: red;font-size: 10px">光管序列号不能为空</span>
            </td>
            <td >
                <font color="red">*</font><input id="after_ldfl" name="after_ldfl" value="${lightReport.afterLdfl}" onkeyup="checkeNum(this)"/>FL
                <br><span id="after_ldflErr" hidden="hidden"  style="color: red;font-size: 10px">请输如0-150之间的整数或小数点后两位数字</span>
            </td>
            <td ><input id="after_dbd" name="after_dbd" value="${lightReport.afterDbd}"/></td>
            <td ><input id="after_jyx" name="after_jyx" value="${lightReport.afterJyx}"/></td>
        </tr>
    </table>
    <div style="width: 98%; margin: 10px auto;">
        环境光亮度:&nbsp;<input id="hjgld" name="hjgld" value="${lightReport.hjgld}"/>FL
    </div>
    <div class="line"></div>
    <div><span style="font-weight: bold;">画面检查</span></div>
    <div style="width: 98%; margin: 10px auto;">
        <span class="color-red">检查全黑/全白/三原色测试图，如有异常（如暗点、亮点、色斑）在下图中对应位置注明</span>
    </div>
    <table class="ftable" style="margin-top:10px;">
        <tr>
            <td width="33%">
                <div class="l-left"><textarea maxlength="50" placeholder="左上" id="lt" name="lt" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.llt}</textarea></div>
            </td>
            <td width="33%">
                <div class="t-top"><textarea maxlength="50" placeholder="中上" id="ct" name="ct" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.ct}</textarea></div>
            </td>
            <td width="33%">
                <div class="r-right"><textarea maxlength="50" placeholder="右上" id="rt" name="rt" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.rt}</textarea></div>
            </td>
        </tr>
        <tr>
            <td width="33%">
                <div class="l-l"><textarea maxlength="50" placeholder="左中" id="lc" name="lc" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.lc}</textarea></div>
            </td>
            <td width="33%">
                <div class="c-c"><textarea maxlength="50" placeholder="中心" id="cc" name="cc" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.cc}</textarea></div>
            </td>
            <td width="33%">
                <div class="r-r"><textarea maxlength="50" placeholder="右中" id="rc" name="rc" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.rc}</textarea></div>
            </td>
        </tr>
        <tr>
            <td width="33%">
                <div class="l-b"><textarea maxlength="50" placeholder="左下" id="lb" name="lb" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.lb}</textarea></div>
            </td>
            <td width="33%">
                <div class="c-b"><textarea maxlength="50" placeholder="中下" id="cb" name="cb" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.cb}</textarea></div>
            </td>
            <td width="33%">
                <div class="r-b"><textarea maxlength="50" placeholder="右下" id="rb" name="rb" style="height: 100%;width: 100%;border: hidden;resize: none">${lightReport.rb}</textarea></div>
            </td>
        </tr>
    </table>
    <div class="line"></div>
    <div><span style="font-weight: bold;">放映机运行检查</span></div>
    <div style="width: 98%; margin: 10px auto;">
        <span class="color-red">开启放映机，如存在异常请在下方做详细描述</span>
        <textarea id="run_des" name="run_des" style="width: 100%; height: 60px; margin-top:10px"  maxlength="200">${lightReport.runDes}</textarea>
    </div>
</div>
</form>
</body>
</html>
